﻿using System;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.Collections.Generic;

namespace RStein.PosterousReader.WP.Extensions
{
    public static class ObservablecollectionExtensions
    {
        public static void AddRange<T>(this ObservableCollection<T> collection, IEnumerable<T> elements)
        {
            if (collection == null)
            {
                throw new ArgumentNullException("collection");
            }

            if (elements == null)
            {
                throw new ArgumentNullException("elements");
            }
            
            elements.ToList()
                    .ForEach(collection.Add);
        }
    }
}
